<?php

/**
 * topic actions.
 *
 * @package    wills
 * @subpackage topic
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class topicActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
	$this->pager = new sfDoctrinePager(
      'Topic',
      sfConfig::get('app_per_page_topics')
    );
    $this->pager->setQuery(Doctrine::getTable('Special')
		->createQuery('a')
		);
    $this->pager->setPage($request->getParameter('page', 1));
    $this->pager->init();
    $this->specials = $this->pager->getResults();

	//拍卖预告
	$categorys = Doctrine::getTable('ArticleCategory');
	$this->yugaoid=$yugaoid=$categorys->findOneByName("拍卖预告")->getId();
	$this->yugaos = Doctrine::getTable('Article')->getArticleByCategory($yugaoid,10);
  }

  public function executeShow(sfWebRequest $request)
  {
	$specialid = $request->getParameter('id');
    $this->special = Doctrine::getTable('Special')->find(array($specialid));
	$this->specialtitle=$this->special->getName();
    $this->forward404Unless($this->special);

	//拍卖资料
	$this->categorys = Doctrine::getTable('ArticleCategory');
	$paimaiid = $this->categorys->findOneByName("拍卖资料")->getId();
	$this->articles = Doctrine::getTable('Article')->getArticleBySpecial($specialid,$paimaiid,10);

	//专题报道
	$this->reports = Doctrine::getTable('Report')->getReportBySpecial($specialid,10);

	//相关图片
	$this->photos = Doctrine::getTable('SpecialPhoto')->getPhotoBySpecial($specialid,5);

	//合作链接
	$this->links = Doctrine::getTable('Link')->getLinkBySpecial($specialid,6);
  }
}

